<template>
  <div>
    <el-dialog title="统计查看" :visible.sync="dialogVisible" width="80%" :before-close="handleClose">
      <el-row>
        <el-col :sm="12" style="text-align:left ;">
          <div class="g-title">单位数目({{this.data.total}}个）</div>
        </el-col>
      </el-row>
      <el-row>
        <el-col :sm="24">
          <div class="table-top">
            <el-table
              ref="multipleTable"
              :data="data"
              tooltip-effect="dark"
              style="width: 100%"
              @selection-change="handleSelectionChange"
              border
            >
              <el-table-column type="selection" width="55"></el-table-column>
              <el-table-column type="index" label="序号" width="80" align="center"></el-table-column>
              <el-table-column prop="companyName" label="单位名称" width="200" align="center"></el-table-column>
              <el-table-column prop="seeYes" label="是否查看" show-overflow-tooltip align="center"></el-table-column>
              <el-table-column prop="username" label="查看人" show-overflow-tooltip align="center"></el-table-column>
              <el-table-column prop="createtime" label="查看时间" width="200" align="center"></el-table-column>

              <el-table-column label="附件下载" width="200" align="center">
                <template slot-scope="scope">
                  <el-link
                    type="primary"
                    :underline="false"
                    @click="toDocument(scope.$index,scope.row)"
                  >{{ scope.row.fjname}}</el-link>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </el-col>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button @click="handleClose">取 消</el-button>
        <el-button type="primary" @click="dialogVisible= false">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { findAllArticles } from "@/api/infomaction";
import { axios } from "@/api/axios";
// 引入vuex
import { mapGetters } from "vuex";
export default {
  props: {
    dialogVisible: {
      type: Boolean,
      default: true
    },
    data: {
      type: Array,
      default: true
    }
  },
  computed: {
    //获取左侧单位勾选的id数组 [1,2,3]
    ...mapGetters(["userInfo", "selectedComIds"])
  },
  data() {
    return {
      tableData: [],
      articleIdName: "",
      multipleSelection: [],
      total: 0,
      pageNo: 1,
      pageSize: 10 //默认每页显示10条
    };
  },
  created() {},
  methods: {
    handleClose() {
      this.$emit("update:dialogVisible", false);
    },
    pageSizeChange(newSize) {
      this.pageSize = newSize;
      this.pageNo = 1;
      // this.fetchData();
    },
    toggleSelection(rows) {
      if (rows) {
        rows.forEach(row => {
          this.$refs.multipleTable.toggleRowSelection(row);
        });
      } else {
        this.$refs.multipleTable.clearSelection();
      }
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
      // console.log(val)
    },
    handleSelectionChange2(val) {
      this.multipleSelection2 = val;
      // console.log(val)
    },
    toDocument(index, row) {
      window.location.href = row.fujianurl;
    }
  }
};
</script>
<style lang="scss" scoped>
.companybook-main {
  margin: 0 auto;
  padding: 10px;
  border-radius: 4px;
  background-color: #fff;
}

.companybook-body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overflow-y: auto;
  background-color: #eef1f6;
  padding: 10px;
}

.g-title {
  height: 20px;
  padding-left: 8px;
  line-height: 22px;
  font-size: 16px;
  font-weight: 400;
  border-left: 2px solid #f54e40;
  margin: 10px 0;
  display: inline-block;
}
</style>
